import { Body, Controller, Delete, Get, Param, Patch, Post, Query } from '@nestjs/common';
import { KitsService } from './kits.service';
import { CreateKitDto } from './dto/create-kit.dto';
import { UpdateKitDto } from './dto/update-kit.dto';
import { ApiOperation, ApiResponse } from '@nestjs/swagger';
import { QueryDto } from './dto/query.dto';
@Controller('kits')
export class KitsController {
  constructor(private readonly kitsService: KitsService) {}
  
  @Post()
  @ApiOperation({ summary: 'Create a new kit' })
  @ApiResponse({
    status: 201,
    description: 'The kit has been successfully created.',
    type: CreateKitDto,
  })
  create(@Body() createKitDto: CreateKitDto) {
    return this.kitsService.create(createKitDto);
  }

  @Get()
  @ApiOperation({ summary: 'Get all kits' })
  @ApiResponse({
    status: 200,
    description: 'The kits have been successfully retrieved.',
    type: [UpdateKitDto],
  })
  findAll(@Query() query: QueryDto) {
    return this.kitsService.findAll(query);
  }

  @Get(':id')
  @ApiOperation({ summary: 'Get a kit by id' })
  @ApiResponse({
    status: 200,
    description: 'The kit has been successfully retrieved.',
    type: UpdateKitDto,
  })
  findOne(@Param('id') id: number) {
    return this.kitsService.findOne(id);
  }

  @Patch(':id')
  @ApiOperation({ summary: 'Update a kit' })
  @ApiResponse({
    status: 200,
    description: 'The kit has been successfully updated.',
    type: UpdateKitDto,
  })
  update(@Param('id') id: string, @Body() updateKitDto: UpdateKitDto) {
    return this.kitsService.update(+id, updateKitDto);
  }

  @Delete(':id')
  @ApiOperation({ summary: 'Delete a kit' })
  @ApiResponse({
    status: 200,
    description: 'The kit has been successfully deleted.',
    type: UpdateKitDto,
  })
  remove(@Param('id') id: string) {
    return this.kitsService.remove(+id);
  }
}
